package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.RecordBean;
import com.lwj.liwanjia.model.RecordModel;
import com.lwj.liwanjia.impl.RecordView;

import rx.Subscriber;

/**
 * Created by Administrator on 2018/1/11.
 */

public class RecordPresenter {
    private RecordModel recordModel;

    private RecordView recordView;

    public RecordPresenter(RecordView recordView) {
        this.recordView = recordView;
        recordModel = new RecordModel();
    }

    public void getRecordData(String token) {
        recordModel.getRecordData(token, new Subscriber<RecordBean>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {
                recordView.showError((Exception) e);
            }

            @Override
            public void onNext(RecordBean recordBean) {
                recordView.getRecordData(recordBean);
            }
        });
    }
}
